package com.zjb.demo.system.domain;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.core.keygen.KeyGenerators;
import com.zjb.demo.common.listener.BaseOnListener;
import com.zjb.demo.common.domain.dto.BaseEntity;
import org.noear.solon.validation.annotation.NotBlank;
import org.noear.solon.validation.annotation.NotNull;
import org.noear.solon.validation.annotation.Size;

import java.io.Serial;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 庄佳彬
 * @since 2023/12/28 23:03
 */
@Table(value = "sys_menu", onInsert = BaseOnListener.class, onUpdate = BaseOnListener.class)
public class SysMenu extends BaseEntity {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 菜单ID
     */
    @Column(value = "menu_id")
    @Id(keyType = KeyType.Generator,value = KeyGenerators.flexId)
    private Long menuId;

    /**
     * 菜单名称
     */
    @Column(value = "menu_name")
    @NotBlank(message = "菜单名称不能为空")
    @Size(max = 50, message = "菜单名称长度不能超过50个字符")
    private String menuName;

    /**
     * 父菜单名称
     */
    @Column(value = "parent_name")
    private String parentName;

    /**
     * 父菜单ID
     */
    @Column(value = "parent_id")
    private Long parentId;

    /**
     * 显示顺序
     */
    @Column(value = "order_num")
    @NotNull(message = "显示顺序不能为空")
    private Integer orderNum;

    /**
     * 路由地址
     */
    @Column(value = "path")
    @Size(max = 200, message = "路由地址不能超过200个字符")
    private String path;

    /**
     * 组件路径
     */
    @Column(value = "component")
    @Size(max = 200, message = "组件路径不能超过255个字符")
    private String component;

    /**
     * 路由参数
     */
    @Column(value = "query")
    private String query;

    /**
     * 是否为外链（0是 1否）
     */
    @Column(value = "is_frame")
    private String isFrame;

    /**
     * 是否缓存（0缓存 1不缓存）
     */
    @Column(value = "is_cache")
    private String isCache;

    /**
     * 类型（M目录 C菜单 F按钮）
     */
    @Column(value = "menu_type")
    @NotBlank(message = "菜单类型不能为空")
    private String menuType;

    /**
     * 显示状态（0显示 1隐藏）
     */
    @Column(value = "visible")
    private String visible;

    /**
     * 菜单状态（0正常 1停用）
     */
    @Column(value = "status")
    private String status;

    /**
     * 权限字符串
     */
    @Column(value = "perms")
    @Size(max = 100, message = "权限标识长度不能超过100个字符")
    private String perms;

    /**
     * 菜单图标
     */
    @Column(value = "icon")
    private String icon;

    /**
     * 子菜单
     */
    @Column(ignore = true)
    private List<SysMenu> children = new ArrayList<>();

    public Long getMenuId() {
        return menuId;
    }

    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public String getQuery() {
        return query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String getIsFrame() {
        return isFrame;
    }

    public void setIsFrame(String isFrame) {
        this.isFrame = isFrame;
    }

    public String getIsCache() {
        return isCache;
    }

    public void setIsCache(String isCache) {
        this.isCache = isCache;
    }

    public String getMenuType() {
        return menuType;
    }

    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    public String getVisible() {
        return visible;
    }

    public void setVisible(String visible) {
        this.visible = visible;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public List<SysMenu> getChildren() {
        return children;
    }

    public void setChildren(List<SysMenu> children) {
        this.children = children;
    }
}
